package com.neusoft.control;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.neusoft.bean.AdminInfoBean;
import com.neusoft.myutils.MyUtil;
import com.neusoft.service.AdminInfoService;

/**
 * 注册转发控制
 */
@WebServlet("/AddAdminInfoServlet")
public class AddAdminInfoServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;

	
	protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		request.setCharacterEncoding("utf-8");
		AdminInfoBean aib = MyUtil.getInstance(AdminInfoBean.class);
		aib.setAdminName(request.getParameter("adminName"));
		aib.setAdminPsw(request.getParameter("adminPsw"));
		aib.setAdminSex(request.getParameter("adminSex"));
		
		aib.setAdminAge(MyUtil.coverStr2Integer(request.getParameter("adminAge")));
		aib.setAdminTel(request.getParameter("adminTel"));
		aib.setAdminEmail(request.getParameter("adminEmail"));
		
		int i = MyUtil.getInstance(AdminInfoService.class).doAddAdminInfo(aib);
		if (i>0) {
			request.getRequestDispatcher("addAdmin/AddSuccess.jsp").forward(request, response);
		} else {

		}
	}

}
